package com.saatcioglu.android.guessthenumber;

import android.content.Context;
import android.content.SharedPreferences;

public class ManageSettings {
	
	static final public String QUICK_SETTINGS_NAME = "GuesstheNumber.QuickSettings";
	static final public String MASTER_SETTINGS_NAME = "GuesstheNumber.MasterSettings";
	static final private String GS_GAMESTARTED = "isGameStarted";
	static final private String GS_EDITORTEXT = "mEditorText";
	static final private String GS_STRINGS = "mStrings_";
	static final private String GS_COUNTER = "intCounter";
	static final private String GS_DIGITSPRESSED = "theDigitsPressed";
	static final private String GS_PREVBUTTONS = "arrintPrevButtons_";
	static final private String GS_ELAPSEDTIME = "lngElapsedTime_";
	static final private String GS_BUTTONENABLED = "arrisButtonEnabled_";
	static final private String GS_BUTTONSTATES = "arrintButtonStates";
	static final private String GS_SECRETNUMBER = "intSecretNumber";

	static final private String US_CURRENTLEVEL = "nCurrentLevel";

	SharedPreferences sharedPreferences;
	SharedPreferences.Editor editor;
	
	ManageSettings(Context context){
		if(context.getClass() == GfxMasterShot.class){
			sharedPreferences = context.getSharedPreferences(MASTER_SETTINGS_NAME, Context.MODE_PRIVATE);
		} else if(context.getClass() == GfxQuickShot.class){
			sharedPreferences = context.getSharedPreferences(QUICK_SETTINGS_NAME, Context.MODE_PRIVATE);
		}
		editor = sharedPreferences.edit();
	}
	
	public void commit(){
		editor.commit();
	}
	
	public void setGameStarted(String gameStarted){
		editor.putString(GS_GAMESTARTED, gameStarted);
	}

	public String getGameStarted(){
		return sharedPreferences.getString(GS_GAMESTARTED, "");
	}

	public void setEditorText(String artist){
		editor.putString(GS_EDITORTEXT, artist);
	}

	public String getEditorText(){
		return sharedPreferences.getString(GS_EDITORTEXT, "");
	}

}
